import { Component, OnInit } from '@angular/core';
import * as $ from "jquery/dist/jquery.min.js";
@Component({
  selector: 'app-article',
  templateUrl: './article.component.html',
  styleUrls: ['./article.component.scss']
})
export class ArticleComponent implements OnInit {
  
  constructor() { }

  ngOnInit() {
    $(".ContentItem-actions span").click(function(){
      if($(this).children(".fa-heart-o").length){
        $(this).children(".fa-heart-o").removeClass("fa-heart-o").addClass("fa-heart");
      }else{
        $(this).children(".fa-heart").removeClass("fa-heart").addClass("fa-heart-o");
      }
      
      // $(this).children(".fa-heart").removeClass("fa-heart").addClass("fa-heart-o");
      
    })

    $(".RichContent-inner button").click(function(){
      $(this).prev().fadeIn();
      $(this).prev().prev().hide();
      
      $(this).hide();
      $(this).parent().next().children(".row").children(".col-md-2").children(".upp").show();
    })

    $(".upp").click(function(){
      $(this).hide();
      var parent = $(this).parents(".ContentItem-actions").prev();
      parent.children("span:eq(1)").hide();
      parent.children("span:eq(0)").fadeIn();
      parent.children("button").show();
    })
  }

}
